<%@page import="model.bean.ChuyenAn"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String uName = (String) request.getSession().getAttribute("uName");
	String role = (String) request.getSession().getAttribute("role");	
	if((uName == null) || !("admin".equals(role) || !"user".endsWith(role))) {
		response.sendRedirect("login.jsp");
	}
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>ĐỒ ÁN TỐT NGHIỆP</title>
<meta
	content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
	name='viewport'>
<%@ include file="jsheader.jsp"%>
<link href="mycss/popup.css" rel="stylesheet" type="text/css" />
</head>
<body class="skin-blue">

	<%
		ChuyenAn ca = (ChuyenAn) request.getAttribute("chuyenAn");
		String sua = (String) request.getAttribute("sua");
	%>
	<!-- header logo: style can be found in header.less -->
	<%@ include file="header.jsp"%>

	<div class="wrapper row-offcanvas row-offcanvas-left">
		<!-- Left side column. contains the logo and sidebar -->
		<%@ include file="menu.jsp"%>

		<!-- Right side column. Contains the navbar and content of the page -->
		<aside class="right-side"> <!-- Content Header (Page header) -->
		<section class="content-header">
		<h1>Quản lý chuyên án</h1>
		<ol class="breadcrumb">
			<li><a href="#"><i class="fa fa-dashboard"></i> Trang chủ</a></li>
			<li><a href="#">Quản lý chuyên án</a></li>
			<li class="active">Cập nhật</li>
		</ol>
		</section> <!-- Main content --> <section class="content">
		<div class="col-md-7">
			<%
				if ("true".equals(sua)) {
			%>
			<div class="alert alert-success alert-dismissable">
				<i class="fa fa-info"></i>
				<button type="button" class="close" data-dismiss="alert"
					aria-hidden="true">×</button>
				<b>Thông báo: </b> Cập nhật thông tin thành công!
			</div>
			<%
				} else if ("false".equals(sua)) {
			%>
			<div class="alert alert-danger alert-dismissable">
				<i class="fa fa-info"></i>
				<button type="button" class="close" data-dismiss="alert"
					aria-hidden="true">×</button>
				<b>Lỗi kết nối: </b> Cập nhật không thành công!
			</div>
			<%
				}
			%>
		</div>
		<div class="row">
			<!-- left column -->
			<div class="col-md-7">
				<!-- general form elements -->
				<div class="box box-primary">
					<!-- /.box-header -->
					<!-- form start -->
					<form action="ChuyenAnServlet" method="post" name="mform">
						<div class="box-body">
							<div class="form-group">
								<input type="hidden" name="idca" id="idca"
									value="<%=ca.getIdChuyenan()%>"> <label>Tên
									chức vụ:</label>
								<div class="input-group">
									<div class="input-group-addon">
										<i class="fa fa-info"></i>
									</div>
									<input class="form-control" type="text" name="tenchuyenan2"
										id="tenchuyenan2" value="<%=ca.getTenChuyenAn()%>">
								</div>
								<label>Ghi chú:</label>
								<div class="input-group">
									<div class="input-group-addon">
										<i class="fa fa-info"></i>
									</div>
									<textarea class="form-control" rows="3" name="ghichu"
										id="ghichu" required="true"
										style="margin: 0px -0.5px 0px 0px; height: 86px;"><%=ca.getGhiChu()%></textarea>
								</div>
								<!-- /.form group -->
							</div>
						</div>
						<!-- Element to pop up -->
						<div id="element_to_pop_up2">
							<a class="button b-close">X</a>
							<h4>Bạn chưa nhập dữ liệu!</h4>
							<a href="#" onclick="popupclose2()"><span
								class="button small pop1">OK</span></a>
						</div>
						<!-- Element to pop up -->
						<div id="element_to_pop_up">
							<a class="button b-close">X</a>
							<h4>Bạn có chắc muốn cập nhập thông tin không?</h4>
							<a href="#" onclick="sua()"><span class="button small pop1">Đồng
									ý</span></a> <a href="#" onclick="popupclose()"><span
								class="button small pop1">Hủy</span></a>
						</div>
					</form>
					<div class="box-footer">
						<button class="btn btn-success" onclick="popup2()">Cập
							nhật</button>
						<a href="ChuyenAnServlet?dsChuyenan" class="btn btn-primary">Bỏ
							qua</a>
					</div>
				</div>
			</div>
			<!-- /.box -->
			<!-- Form Element sizes -->
		</div>
		<!--/.col (left) --> <!-- /.row --> </section> <!-- /.content --> </aside>
		<!-- /.right-side -->
	</div>
	<!-- ./wrapper -->
	<!-- jQuery 2.0.2 -->
	<script src="js/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script src="js/bootstrap.min.js" type="text/javascript"></script>
	<!-- InputMask -->
	<script src="js/plugins/input-mask/jquery.inputmask.js"
		type="text/javascript"></script>
	<script src="js/plugins/input-mask/jquery.inputmask.date.extensions.js"
		type="text/javascript"></script>
	<script src="js/plugins/input-mask/jquery.inputmask.extensions.js"
		type="text/javascript"></script>
	<script src="js/AdminLTE/app.js" type="text/javascript"></script>
	<!-- AdminLTE for demo purposes -->
	<script src="js/AdminLTE/demo.js" type="text/javascript"></script>
	<!-- bpopup scrip -->
	<script src="myjs/bpopup.min.js"></script>
	<!-- Page script -->
	<script type="text/javascript">
		function popup2() {
			var tenchuyenan2 = document.getElementById('tenchuyenan2').value;
			var idca = document.getElementById('idca').value;
			var ghichu = document.getElementById('ghichu').value;
			if (tenchuyenan2 == "" || ghichu == "") {
				$('#element_to_pop_up2').bPopup({
					speed : 650,
					transition : 'slideIn',
					transitionClose : 'slideBack'
				});
			} else {
				$('#element_to_pop_up').bPopup({
					speed : 650,
					transition : 'slideIn',
					transitionClose : 'slideBack'
				});
			}
		}

		function sua() {
			document.forms["mform"].submit();
		}

		function popupclose() {
			$('#element_to_pop_up').bPopup().close();
		}
		function popupclose2() {
			$('#element_to_pop_up2').bPopup().close();
		}
	</script>
</body>
</html>